package day05;

import java.util.Random;

public class MaxAndMinOfArray {
    public static void main(String[] args) {
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new Random().nextInt(100);
            System.out.print(arr[i] + " ");
        }
        System.out.println();

        int max = arr[0], min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
            if(min > arr[i]){
                min = arr[i];
            }
        }
        System.out.println("最大值为：" + max+"，最小值为：" + min);
    }
}
